using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace DynamicTextTest
{
    public partial class EvaluationForm : Form
    {
        private SharpMud.Text.Dynamic.ICompiledDynamicTextBody _cDTB;
        public EvaluationForm(SharpMud.Text.Dynamic.ICompiledDynamicTextBody cDTB)
        {
            _cDTB = cDTB;
            InitializeComponent();
            textBox1.ReadOnly = true;

            btnRefresh_Click(null, null);
        }

        private void btnRefresh_Click(object sender, EventArgs e)
        {
            System.IO.StringWriter sw = new System.IO.StringWriter();
            SimpleEvalContext sec = new SimpleEvalContext(sw);
            _cDTB.Execute(sec);
            sw.Flush();

            textBox1.Text = sw.ToString();
        }
    }
}